Skip to content

Conversation

@ax3l
Copy link
Member

@ax3l ax3l commented Jun 10, 2025

This set of tests is used for performance benchmarking of individual elements pushes (as micro-benchmarks). We use this file to rapidly evaluate performance changes when tuning beamline element performance on CPUs and GPUs.

This integrates seamless with our pytest tests, e.g., to run only the benchmark tests (after pip_install):

python -m pytest tests/python/test_benchmark_elements.py

There are additional command line flags for saving outputs and comparing them in the pytest-benchmark documentation.

Depends on:

@ax3l ax3l force-pushed the pytest-benchmark branch from d31f71e to ab93ff8 Compare June 17, 2025 18:20
ax3l added 2 commits June 17, 2025 12:59
Useful to attach more data at Python runtime to the `sim` object.
@ax3l ax3l force-pushed the pytest-benchmark branch from ab93ff8 to 688ac5a Compare June 17, 2025 20:19
This set of tests is used for performance benchmarking of individual
elements pushes (as micro-benchmarks). We use this file to rapidly
evaluate performance changes when tuning beamline element performance
on CPUs and GPUs.
@ax3l ax3l force-pushed the pytest-benchmark branch from 688ac5a to 734197c Compare June 17, 2025 21:15
@ax3l ax3l removed the request for review from atmyers June 17, 2025 22:04

def test_ThinDipole(benchmark, sim):
el = elements.ThinDipole(name="kick", theta=0.45, rc=1.0)
benchmark.pedantic(el.push, setup=partial(pc_setup, sim), rounds=rounds)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add a post-benchmark validation that:

  • particles where not marked as invalid (e.g., turned out)
  • no inf/nan is present in the pushed particle beam attributes

Copy link
Member

@cemitch99 cemitch99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggested a simplification of the beam energy/distribution inputs. I think it's ok to leave the element parameters unchanged (from the originating examples). Otherwise, it looks good to me.

Co-authored-by: Chad Mitchell <[email protected]>
@ax3l ax3l force-pushed the pytest-benchmark branch from 3afff40 to cdee241 Compare June 20, 2025 20:03
@ax3l ax3l enabled auto-merge (squash) June 20, 2025 20:04
@ax3l ax3l merged commit 6b06df3 into BLAST-ImpactX:development Jun 20, 2025
16 checks passed
@ax3l
Copy link
Member Author

ax3l commented Jun 23, 2025

ouch, because we did not release ImpactX yet, this relies on post 25.06 changes #993 in pyAMReX/WarpX -.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: tests examples, tests and benchmarks Performance optimization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants